import { ColumnOptionsType, DimensionAdvanced } from "@/utils/dict";

export function containAdvanced(advanced: DimensionAdvanced, dimensionAdvanced?: string): boolean {
  if (!dimensionAdvanced) {
    return false;
  }
  return dimensionAdvanced.includes(DimensionAdvanced.multi_select);
}

export function addAdvanced(advanced: DimensionAdvanced, dimensionAdvanced?: string): string {
  if (!dimensionAdvanced) {
    return advanced;
  }
  if (containAdvanced(advanced, dimensionAdvanced)) {
    return dimensionAdvanced;
  }
  return `${dimensionAdvanced},${advanced}`;
}

export function removeAdvanced(advanced: DimensionAdvanced, dimensionAdvanced?: string): string {
  if (!dimensionAdvanced) {
    return "";
  }
  return dimensionAdvanced
    .split(",")
    .filter(item => item != DimensionAdvanced.multi_select)
    .join(",");
}
